package model

//	type Stocks struct {
//		BaseModel
//		Name    string
//		Address string
//	}

type Inventory struct {
	BaseModel
	Goods   int32 `gorm:"type:int;index"` //商品 index索引
	Stocks  int32 `gorm:"type:int"`       //库存
	Version int32 `gorm:"type:int"`       //分布式锁的乐观锁
}

type InventoryNew struct {
	BaseModel
	Goods   int32 `gorm:"type:int;index"` //商品 index索引
	Stocks  int32 `gorm:"type:int"`       //库存
	Version int32 `gorm:"type:int"`       //分布式锁的乐观锁
	Freeze  int32 `gorm:"type:int"`       //冻结库存
}

type DeliveryHistory struct {
	Goods   int32  `gorm:"type:int;index"`
	Nums    int32  `gorm:"type:int"`
	OrderSn string `gorm:"type:varchar(200)"`
	Status  string `gorm:"type:varchar(200)"` //1 表示待支付 2 表示支付成功 3失败
}
type StockSellDetail struct {
	OrderSn string          `gorm:"type:varchar(200);index:idx_order_sn,unique;"`
	Status  int32           `gorm:"type:varchar(200)"` //1 表示已扣减 2 表示已归还
	Detail  GoodsDetailList `gorm:"type:varchar(200)"`
}

func (StockSellDetail) TableName() string {
	return "stockselldetail"
}

//type InventoryHistory struct {
//	user   int32
//	goods  int32
//	nums   int32
//	order  int32
//	status int32 //1. 表示库存扣减,幂等性 2.表示已经支付
//}
